import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Index from '../views/Index.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: "/",
        redirect: "/index"
      },
      {
        path: "/index",
        name: "index",
        component: Index,
        meta: {
          title: "每时每刻",
          keepAlive: true
        }
      },
      {
        path: "/course",
        name: "course",
        // 路由懒加载    箭头函数   返回   import导入的组件
        component: () => import("../views/course.vue"),
        meta: {
          title: "特色课",
          keepAlive: true,
        }
      },
      {
        path: "/record",
        name: "record",
        // 路由懒加载    箭头函数   返回   import导入的组件
        component: () => import("../views/record.vue"),
        meta: {
          title: "约课记录",
          keepAlive: true,
        }
      },
      {
        path: "/practice",
        name: "practice",
        // 路由懒加载    箭头函数   返回   import导入的组件
        component: () => import("../views/practice.vue"),
        meta: {
          title: "练习",
          keepAlive: true,
        }
      },
      {
        path: "/mine",
        name: "mine",
        // 路由懒加载    箭头函数   返回   import导入的组件
        component: () => import("../views/mine.vue"),
        meta: {
          title: "我的",
          keepAlive: true,
        }
      },
    ]
  },
  {
    path: "/mine1",
    name: "mine1",
    component: () => import("../views/mine1.vue"),
    meta: {
      title: "我的1",
      keepAlive: true,
    }
  },
  {
    path: "/courceDetail",
    name: "courceDetail",
    component: () => import("../views/courceDetail.vue"),
    meta: {
      title: "课程详情",
      keepAlive: true,
    }
  },
  {
    path: "/teacherDetail",
    name: "teacherDetail",
    // 路由懒加载    箭头函数   返回   import导入的组件
    component: () => import("../views/teacherDetail.vue"),
    meta: {
      title: "老师详情",
      keepAlive: true,
    }
  },
  {
    path: "/calendar",
    name: "calendar",
    // 路由懒加载    箭头函数   返回   import导入的组件
    component: () => import("../views/calendar.vue"),
    meta: {
      title: "学习日历",
      keepAlive: true,
    }
  },
  {
    path: "/oto",
    name: "oto",
    // 路由懒加载    箭头函数   返回   import导入的组件
    component: () => import("../views/oto.vue"),
    meta: {
      title: "一对一辅导",
      keepAlive: true,
    }
  },
  {
    path: "/search",
    name: "search",
    // 路由懒加载    箭头函数   返回   import导入的组件
    component: () => import("../views/search.vue"),
    meta: {
      title: "搜索页面",
      keepAlive: true,
    }
  },
  {
    path: "/register",
    name: "register",
    component: () => import("../views/register.vue"),
    meta: {
      title: "注册/验证码登录页面",
      keepAlive: true,
    }
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/login.vue"),
    meta: {
      title: "密码登录页面",
      keepAlive: true,
    }
  },
  {
    path: "/setPassword",
    name: "setPassword",
    component: () => import("../views/setPassword.vue"),
    meta: {
      title: "密码登录页面",
      keepAlive: true,
    }
  },
  {
    path: "/userInfo",
    name: "userInfo",
    component: () => import("../views/userInfo.vue"),
    meta: {
      title: "个人信息",
      keepAlive: true,
    }
  },
  {
    path: "/sex",
    name: "sex",
    component: () => import("../views/sex.vue"),
    meta: {
      title: "个人信息",
      keepAlive: true,
    }
  },

  {
    path: "/xgUser",
    name: "xgUser",
    component: () => import("../views/xgUser.vue"),
    meta: {
      title: "修改用户名",
      keepAlive: true,
    }
  },
  {
    path: "/collection",
    name: "collection",
    component: () => import("../views/collection.vue"),
    meta: {
      title: "我的收藏",
      keepAlive: true,
    }
  },
  {
    path: "/myStudy",
    name: "myStudy",
    component: () => import("../views/myStudy.vue"),
    meta: {
      title: "关注讲师",
      keepAlive: true,
    }
  },

]

const router = new VueRouter({
  // 设置路由模式
  // mode:"hash",
  routes
})

export default router
